package edu.gdkm.demo8;

import java.io.File;
import java.io.IOException;

public class FileDemo {
    public static void main(String[] args) throws IOException {
        File f = new File("d:\\javatest.txt");
        System.out.println(f.exists());
        System.out.println(f.isFile());
        System.out.println(f.isDirectory());
        f.createNewFile();
        System.out.println("------------------------");
        //                     d:/javaapp/ershidabaogao.txt
        File f2 = new File("d:"+File.separator+"javaapp"+File.separator+ "ershidabaogao.txt");
        System.out.println(f2.exists());
        System.out.println(f2.isFile());
        System.out.println(f2.isDirectory());
        System.out.println("------------------");
        File f3= new File("D:\\JavaApp");
        String[] filenames=f3.list();
        for(int i=0 ;i<filenames.length;i++){
            System.out.println(filenames[i]);
        }

    }
}
